<template>
	<view class="t_wrapper">
		<view class="p_font_28 p_margin_b_32">第一步：复制淘口令，打开淘宝APP：</view>
		<view class="p_font_26 p_color_7a p_two_text">{{password}}</view>
		<view class="p_font_24 p_color_05b570 t_btn" @click="getCopy(password)">一键复制</view>
		<view class="p_font_28 p_margin_b_32 p_margin_t_48">第二步：联系淘宝客服，发送：</view>
		<view class="p_flex9 p_margin_b_32">
			<view class="p_font_32 p_color_05b570">已传文件+{{orderNumber}}</view>
			<view class="p_font_24 p_color_05b570 t_btn" style="margin-top: 0;" @click="getCopy(orderNumber)">一键复制</view>
		</view>
		<image :src="images" mode="widthFix" style="width: 100%;"></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				password: '',
				images: '',
				phone: '',
				orderNumber: '',
			}
		},
		onLoad(e) {
			this.getInfo();
			if(e.id) {
				this.getDetail(e.id);
			}
			if(e.phone) {
				this.phone = e.phone;
			}
			if(e.orderNumber) {
				this.orderNumber = e.orderNumber;
			}
		},
		methods: {
			getInfo() {
				this.$http.post(this.$api.priceRemark).then(res => {
					this.password = res.data.password;
					this.images = res.data.taobao_image;
				})
			},
			getCopy(e) {
				let self = this;
				uni.setClipboardData({
					data: e, // 复制的文本内容
					success(res) {
						getApp().getMsg('复制成功', 'success');
					},
					fail(err) {
						getApp().getMsg('复制失败，请重试');
					}
				});
			},
			getDetail(id) {
				this.$http.post(this.$api.orderDetail, {
					id: id
				}).then(res => {
					this.phone = res.data.phone;
					this.orderNumber = res.data.order_num;
				})
			},
		}
	}
</script>

<style lang="less">
	.t_wrapper {
		padding: 48rpx 32rpx;
	}

	.t_btn {
		width: 144rpx;
		height: 50rpx;
		box-sizing: border-box;
		border: 1px solid #E8E8E8;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 80rpx;
		margin-top: 16rpx;
	}
</style>